package com.example.permission.controller;

import com.example.permission.model.req.DisableUserDTO;
import com.example.permission.model.req.UpdateSystemDTO;
import com.example.permission.model.resp.SystemUserVO;
import com.example.permission.service.SystemUserService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author qwer3
 * @version 1.0.0
 * @create 2025/11/15 21:31
 */
@RestController
@RequestMapping("/api/sys/user")
@RequiredArgsConstructor
public class UserController {
    private final SystemUserService systemUserService;

    @GetMapping("/list")
    public List<SystemUserVO> getSystemUser(@RequestParam(value = "nickName", required = false) String nickName) {
        // todo checkIsSystemAdmin();
        return systemUserService.getSystemUser(nickName);
    }

    @PostMapping("/disabled")
    public void disableSystemUser(@RequestBody DisableUserDTO disableUserDTO) {
        // todo checkIsSystemAdmin();
        systemUserService.disableSystemUser(disableUserDTO.getUserId());
    }

    @PutMapping("/update")
    public void updateSystemUser(@RequestBody UpdateSystemDTO updateSystemDTO) {
        systemUserService.updateSystemUser(updateSystemDTO);
    }
}
